home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / basic / qbware.exe / PRNTSTAT.BAS < prev    next >
BASIC Source File  |  1990-11-30  |  2KB  |  70 lines

  1. '*****************************************************************************
  2.  
  3. 'Copyright (c) 1987,1988 Marcel Madonna
  4.  
  5. 'PRNTSTAT.BAS shows the use of a BIOS routine to check printer status.
  6. 'This can prevent those annoying device time-outs that occur when you
  7. 'run out of paper or the printer heats up a little.
  8. '
  9. ' ********************* N O T E *************************
  10. '
  11. 'This program cannot be used from the DOS prompt without Microsoft
  12. 'QuickBasic V4.0 and a registered copy of QBWARE.
  13. '
  14. 'To compile it, at the DOS prompt type:
  15.  
  16. '               bc PRNTSTAT;
  17. '               link /ex /noe PRNTSTAT,,,brun40 qbware;
  18. '               del PRNTSTAT.obj
  19. '               del PRNTSTAT.map
  20.  
  21. 'To run it fromthe QuickBasic development environment, type:
  22. '
  23. '               qb PRNTSTAT /l qbware
  24. '               [Shift] + F5
  25.  
  26.  
  27. '*****************************************************************************
  28.  
  29.     CLS
  30.     PRINT "PrntStat - Version 1.0  (C) Copyright 1987 AJM Software"
  31.     PRINT
  32.  
  33. '      The following code segment will check the status of the printer
  34. '      at LPT1 and interrogate the results
  35.  
  36.       Printer% = 0                              'Use LPT1
  37.       CALL BsPStat(Printer%, Rc%)               'Get status of printer
  38.  
  39.       Printer.Ready% = (Rc% AND 128) = 128     '1st bit indicates printer ready
  40.       Acknowledge% = (Rc% AND 64) = 64         '2nd bit indicates Ack
  41.       Out.of.Paper% = (Rc% AND 32) = 32        '3rd bit indicates out of paper
  42.       Selected% = (Rc% AND 16) = 16            '4th bit indicates Selected
  43.       IO.Error% = (Rc% AND 8) = 8              '5th bit indicates I/O Error
  44.       Timeout% = (Rc% AND 1) = 1               '8th bit indicates Timeout
  45.  
  46.       IF Printer.Ready% THEN
  47.     PRINT " ...Printer at LPT1 reports Ready"
  48.       END IF
  49.  
  50.       IF Acknowledge% THEN
  51.     PRINT " ...Printer at LPT1 reports Acknowledge"
  52.       END IF
  53.  
  54.       IF Out.of.Paper% THEN
  55.     PRINT " ...Printer at LPT1 reports Out of Paper or Paper jam"
  56.       END IF
  57.  
  58.       IF IO.Error% THEN
  59.     PRINT " ...Printer at LPT1 reports I/O error or Printer off-line"
  60.       END IF
  61.  
  62.       IF Timeout% THEN
  63.     PRINT " ...Printer at LPT1 has timed out"
  64.       END IF
  65.  
  66.       IF Selected% THEN
  67.     PRINT " ...Printer at LPT1 is selected"
  68.       END IF
  69.  
  70.